var xjrightChart3 = echarts.init(document.getElementById('right_chart3'),'macarons');

//xAxisdata1, seriesdata1
InitChart()

function InitChart() {
    var option = {
        // backgroundColor:'rgba(255, 255, 255, 0.9)', //设置无背景色
        title : {
            //      text: '监测接收机正常率'
        },
        tooltip : {
            trigger: 'axis'
        },
        //   legend: {
        //       data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
        //   },
        color:['#2cffff'],
        toolbox: {
            show : false,
            feature : {
                mark : {show: true},
                dataView : {show: true, readOnly: false},
                magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                restore : {show: true},
                saveAsImage : {show: true}
            }
        },
        calculable : true,
        grid: {
            left: '50',
            right: '80',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type: 'category',
                boundaryGap: false,
                data: [
                    "2018/01",
                    "2018/02",
                    "2018/03",
                    "2018/04",
                    "2018/05",
                    "2018/06",
                    "2018/07",
                    "2018/01",
                    "2018/02",
                    "2018/03",
                    "2018/04",
                    "2018/05",
                    "2018/06",
                    "2018/07",
                    "2018/01",
                    "2018/02"
                ],
                axisLabel:{
                    show:true,
                    textStyle: {
                        color: '#fff',
                        fontSize:40
                    }

                },
                axisLine:{
                    lineStyle:{
                        color: '#56f0ed',
                        width:5
                    }
                }
            }
        ],
        yAxis : [
            {
                name:'(%)',
                nameTextStyle:{
                    color:"#fff",
                    fontSize:40
                },
                type: 'value',
                min:0,
                max:100,
                interval:10,
                axisLabel: {
                    show: true,
                    // interval: 'auto',
                    // formatter: '{value}%',
                    // position: 'left',
                    // nameLocation: 'middle',
                    // nameGap: 35,
                    textStyle: {
                        color: '#fff',
                        fontSize:40
                    }
                },
                show: true,
                splitLine:{
                    show:false
                },
                axisLine:{
                    lineStyle:{
                        color: '#56f0ed',
                        width:5
                    }
                }
            }
        ],
        series : [
            {
                name:'北斗监测接收机1',
                type:'line',
                symbol: 'circle',
                symbolSize: 20,
                smooth:false,
                areaStyle: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgb(11,108,236,0.9)'
                    }, {
                        offset: 1,
                        color: 'rgb(11,108,236,0)'
                    }])
                },
                lineStyle:{
                    width:5
                },
                data:[60,80,45,65,55,65,92,52,74,82,65,83,72,90,55,75,54,57,98,58,89,58,92,82,67,100,70,92,72,83,68,55,64,60,83,64,99,77,82,80,75,93,85,62,76,56,96]
            },
        ]
    };

    xjrightChart3.setOption(option);
    window.onresize = function() {
        xjrightChart3.resize();
    }
}
setInterval(function() {
    var op = xjrightChart3.getOption();
    var data0 = op.series[0].data;


    op.series[0].data.push(data0.shift());

    // var data2 = op.series[0].data;
    // op.xAxis[0].data.shift();
    // op.xAxis[0].data.push(xAxisdata2);
    // console.log(data0,data1,data2);
    xjrightChart3.setOption(op);

    // myChart.setOption({
    //       xAxis: {
    //           data: xAxisdata2
    //       },
    //       series: [{
    //           data: seriesdata2[0]
    //       },{
    //         data:seriesdata2[1]
    //       }]
    //   });
}, 5000);
